<template>
  <div>
    <v-header :seller="seller"></v-header>
    <div class="tab border-1px">
      <div class="tab-item">
        <router-link :to="{name: 'goods'}">
          <div class="tab-item">商品</div>
        </router-link>
      </div>
      <div class="tab-item">
        <router-link :to="{name: 'ratings'}">
          <div class="tab-item">评论</div>
        </router-link>
      </div>
      <div class="tab-item">
        <router-link :to="{name: 'seller'}">
          <div class="tab-item">卖家</div>
        </router-link>
      </div>
     
    </div>
      <router-view :seller="seller"></router-view>

  </div>
</template>

<script>
import {urlParse} from './common/js/utils'
import header from './components/header/header.vue'
export default{
  data() {
    return {
      seller: {
        id: (() => {
          let queryParam = urlParse()
       
          return queryParam
        })()
      }
    }
  },
  created(){
    this.$http.get('/api/seller?id=' +this.seller.id).then((response) => {
      response = response.body
      if(response.errno === 0){
        // this.seller = response.data
        // 拓展对象的方法
        this.seller = Object.assign({}, this.seller.id, response.data)


      }
    })
  },
  components: {
    'v-header': header
  }
}
</script>

<style lang="stylus">
  @import './common/stylus/mixin.styl'
  .tab
    display:flex
    width: 100%
    height: 40px
    line-height: 40px
    .tab-item
      flex: 1
      text-align: center
      font-size: 14px
      color: rbg(77, 85, 93)
      .active
        color: rgb(240, 20, 20)
</style>
